﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NFAPI
{
    public static class QueueDal
    {
        public static Queue GetDiscQueueAvailable(INetflixService service, int startIndex)
        {
            return (Queue)SerializationHelper.FromXml(typeof(Queue), service.GetDiscQueueAvailable(startIndex));
        }

        public static Queue GetDiscQueueAvailable(INetflixService service)
        {
            return GetDiscQueueAvailable(service, 0);
        }

        public static Queue GetDiscQueue(INetflixService service, int startIndex)
        {
            return (Queue)SerializationHelper.FromXml(typeof(Queue), service.GetDiscQueue(startIndex));
        }

        public static QueueUpdateStatus UpdateDiscQueue(INetflixService service, QueueItem item, Queue queue)
        {
            return (QueueUpdateStatus)SerializationHelper.FromXml(typeof(QueueUpdateStatus), service.UpdateDiscQueue(item.TitleLink.Href, item.Position, queue.ETag));
        }

        public static Queue GetInstantWatchQueue(INetflixService service, int startIndex)
        {
            return (Queue)SerializationHelper.FromXml(typeof(Queue), service.GetInstantWatchQueue(startIndex));
        }

        public static QueueUpdateStatus UpdateInstantWatchQueue(INetflixService service, QueueItem item, Queue queue)
        {
            return (QueueUpdateStatus)SerializationHelper.FromXml(typeof(QueueUpdateStatus), service.UpdateInstantWatchQueue(item.TitleLink.Href, item.Position, queue.ETag));
        }

        public static Status DeleteQueueEntry(INetflixService service, QueueItem item)
        {
            return (Status)SerializationHelper.FromXml(typeof(Status), service.DeleteQueueItem(item.Id));
        }
    }
}
